package chap04;

import java.text.NumberFormat;

public class NumberTest {
   public static void main(String [] args){
        NumberTest();
   }
   public  static void NumberTest(){
       Integer i=new Integer(100);
       Double d =new Double("123.345");
       int j=i.intValue()+d.intValue();
       float f=i.floatValue()+d.floatValue();
       System.out.println(j);
       System.out.println(d);
       Double pi=Double.parseDouble("3.1434234");
       Double r =Double.valueOf("2.0").doubleValue();
       Double s=pi*r*r;
       System.out.println(s);
   }
   public static void NumberFormat(){
       NumberFormat nf =null;
       nf=NumberFormat.getInstance();
       nf.setMaximumFractionDigits(4);
       nf.setMinimumFractionDigits(2);
       System.out.println("格式化之后的数字:"+nf.format(10000));
       System.out.println("格式化之后的数字:"+nf.format(10000.12312312));
   }
}
